-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Concatenation of series of differing types should lead to object #21922
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
this is not generally the correct solution, the EA should decide what the result should be. we need additional API for this I think in EA. |
best also to do an example with the test EA class |
As long as we do not have such additional api that handles negotation between different EA types on what the result should be, I think this PR is the good solution.
@xhochy mentioned there is no test EA class that can do this (eg with the DecimalArray test case you don't get this bug) |
and this PR should propose such a solution. otherwise everything is just a band aid. |
The question is maybe also in general if it is needed to have a 'i' kind in your fletcher dtypes (instead of always 'O'). I am not sure to what extent we currently use that information for EAs. |
Why? We already do exactly the same for dataframes, there we simply always convert to object if they are not matching dtypes. |
not sure what you are talking about, this is the obvious case of having an EA be able to do something intelligent on concat rather than simply coercing. It can always raise not implemented error and then this soln is fine. In any event this needs tests. |
Did you see the example in the issue? () Concatting a dataframe already works (if converting to object is assumed to be the correct behaviour, which it is at the moment IMO), concatting a series not. This PR is fixing that inconsistency. |
As I said before, I think this is a reasonable fix. @jreback can respond again (also to my last comment, this is basically doing for Series what already is done for DataFrame. The main difficulty is tests) |
I am still not clear what this is fixing, this would need a general extension test. |
closing. this needs tests, if you want to continue pls ping. |
git diff upstream/master -u -- "*.py" | flake8 --diff
I see no simple solution on how to make a test for this without introducing a whole new ExtensionArray class that is actually of scalar type
'i'
.cc @jreback I'm wondering a bit why this has not yet been a problem for #21160
I have check that this fixes the problems I'm seeing in
fletcher
onint
andfloat
dtypes.